import axios  from "@/utils/request";
//加入购物车
export function addCart(data:{
    userid:string,
    proid:string,
    num:string | number,
    
}){
    return axios({
        url:'/cart/add',
        method:"post",
        data
    })
}
//查看购物车
export function cartListFn(data:{
    userid:string,
    header: {
        token: string | null;
    }
}){
    return axios({
        url:'/cart/list',
        method:"post",
        data
    })
}
//更新购物车数量
export function updateCartFn(data:{
    cartid:string,
    num:number,
    header: {
        token: string | null;
    }
}){
    return axios({
        url:'/cart/updatenum',
        method:"post",
        data
    })
}
//单选
export function selectoneFn(data:{
    cartid:string,
    flag:Boolean,
    header: {
        token: string | null;
    }
}){
    return axios({
        url:'/cart/selectone',
        method:"post",
        data
    })
}
//全选
export function selectallFn(data:{
    userid:string,
    type:Boolean,
    header: {
        token: string | null;
    }
}){
    return axios({
        url:'/cart/selectall',
        method:"post",
        data
    })
}
//删除单挑购物车
export function removeCartFn(data:{
    cartid:string,
    header: {
        token: string | null;
    }
}){
    return axios({
        url:'/cart/remove',
        method:"post",
        data
    })
}
//删除全部购物车
export function removeallCartFn(data:{
    userid:string,
    header: {
        token: string | null;
    }
}){
    return axios({
        url:'/cart/removeall',
        method:"post",
        data
    })
}
